package cn.iocoder.yudao.module.jky.dal.mysql.goodsattribute;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.jky.dal.dataobject.goodsattribute.GoodsAttributeDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.jky.controller.admin.goodsattribute.vo.*;

/**
 * 商品属性 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface GoodsAttributeMapper extends BaseMapperX<GoodsAttributeDO> {

    default PageResult<GoodsAttributeDO> selectPage(GoodsAttributePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<GoodsAttributeDO>()
                .eqIfPresent(GoodsAttributeDO::getGoodsCatId, reqVO.getGoodsCatId())
                .likeIfPresent(GoodsAttributeDO::getGoodsAttributeName, reqVO.getGoodsAttributeName())
                .eqIfPresent(GoodsAttributeDO::getSort, reqVO.getSort())
                .eqIfPresent(GoodsAttributeDO::getIsShow, reqVO.getIsShow())
                .orderByDesc(GoodsAttributeDO::getGoodsAttributeId));
    }

    default List<GoodsAttributeDO> selectList(GoodsAttributeExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<GoodsAttributeDO>()
                .eqIfPresent(GoodsAttributeDO::getGoodsCatId, reqVO.getGoodsCatId())
                .likeIfPresent(GoodsAttributeDO::getGoodsAttributeName, reqVO.getGoodsAttributeName())
                .eqIfPresent(GoodsAttributeDO::getSort, reqVO.getSort())
                .eqIfPresent(GoodsAttributeDO::getIsShow, reqVO.getIsShow())
                .orderByDesc(GoodsAttributeDO::getGoodsAttributeId));
    }

}
